// 它专门用来进行网络请求
import { get } from '../utils/request'
import config from '../config/filmConfig'


// 获取电影幻灯片
export const getBannerApi = async () => {
  let ret = await get(config.banner, {
    headers: {
      'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.0.4","e":"1614151226158351149236225","bc":"110100"}',
      'X-Host': 'mall.cfg.common-banner'
    }
  });
  // 如果你只返回一个对象，则可以用小括号括起来写在一行完成返回
  return ret.data.map(({ bannerId, imgUrl }) => ({ id: bannerId, url: imgUrl }))
};

// 获取正在热映分页数据
export const getNowPlayingFilmListApi = (page = 1) => get(config.getNowPlayingFilmList + page)
